<!DOCTYPE html>
<html>
<head>
    <title>考试表</title>
    <#include "/header.html">
    <link href="${request.contextPath}/statics/css/test.css" rel="stylesheet" type="text/css"/>
    <link rel="stylesheet" href="${request.contextPath}/statics/css/bootstrap-table.min.css">
    <link rel="stylesheet" href="${request.contextPath}/statics/plugins/treegrid/jquery.treegrid.css">
    <script src="${request.contextPath}/statics/libs/bootstrap-table.min.js"></script>
    <script src="${request.contextPath}/statics/plugins/treegrid/jquery.treegrid.min.js"></script>
    <script src="${request.contextPath}/statics/plugins/treegrid/jquery.treegrid.bootstrap3.js"></script>
    <script src="${request.contextPath}/statics/plugins/treegrid/jquery.treegrid.extension.js"></script>
    <script src="${request.contextPath}/statics/plugins/treegrid/tree.table.js"></script>
</head>
<body>
<div id="rrapp" v-cloak>
    <div v-show="showList" id="show1">
        <div class="grid-btn">
            <div class="form-group col-sm-2">
                <input type="text" class="form-control" style="cursor:pointer;" v-model="q.deptName"
                       @click="deptTree2" readonly="readonly" placeholder="参考部门"/>
            </div>
            <div class="form-group col-sm-2">
                <input type="text" class="form-control" v-model="q.name" @keyup.enter="query" placeholder="试题名称">
            </div>
            <div class="form-group col-sm-1">
                <input type="text" class="form-control" v-model="q.type" @keyup.enter="query" placeholder="试题类型">
            </div>
            <a class="btn btn-default" @click="query">查询</a>
            <#if shiro.hasPermission("sys:systest:save")>
            <!--<a class="btn btn-primary" @click="info"><i class="fa fa-file-text-o"></i>&nbsp;预览</a>-->
            <a class="btn btn-primary" @click="add"><i class="fa fa-plus"></i>&nbsp;新增</a>
        </#if>
        <#if shiro.hasPermission("sys:systest:update")>
        <a class="btn btn-primary" @click="update"><i class="fa fa-pencil-square-o"></i>&nbsp;修改</a>
    </#if>
    <#if shiro.hasPermission("sys:systest:delete")>
    <a class="btn btn-primary" @click="del"><i class="fa fa-trash-o"></i>&nbsp;删除</a>
</#if>
</div>
<table id="jqGrid"></table>
<div id="jqGridPager"></div>
</div>

<div v-show="!showList" class="panel panel-default">
    <div class="panel-heading">{{title}}</div>
    <form class="form-horizontal">
        <div class="form-group">
            <div class="col-sm-2 control-label">试题名称</div>
            <div class="col-sm-10">
                <input type="text" class="form-control" v-model="sysTest.name" placeholder="试题名称"/>
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-2 control-label">试题类型</div>
            <div class="col-sm-10">
                <select v-model="sysTest.type" class="refresh-seconds-select btn"
                        style="width:370px;border: 1px solid #ccc;">
                    <option v-for="item in type" :value="item.value">{{item.text}}</option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-2 control-label">出题方式</div>
            <div class="col-sm-10">
                <select v-model="sysTest.typet" class="refresh-seconds-select btn"
                        style="width:370px;border: 1px solid #ccc;" @change='changet'>
                    <option v-for="item in typet" :value="item.value">{{item.text}}</option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-2 control-label">答题时间</div>
            <div class="col-sm-10">
                <input type="text" class="form-control" v-model="sysTest.times" placeholder="答题时间（分钟）"/>
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-2 control-label">试题总分</div>
            <div class="col-sm-10">
                <input type="text" class="form-control" v-model="sysTest.price" placeholder="试题总分"/>
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-2 control-label">通过分数</div>
            <div class="col-sm-10">
                <input type="text" class="form-control" v-model="sysTest.inprice" placeholder="通过分数"/>
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-2 control-label">开考时间</div>
            <div class="col-sm-10">
                <input type='datetime-local' class="form-control" v-model="sysTest.startTime" placeholder="开始时间"/>
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-2 control-label">结束时间</div>
            <div class="col-sm-10">
                <input type='datetime-local' class="form-control" v-model="sysTest.endTime" placeholder="结束时间"/>
            </div>
        </div>
        <div class="form-group" id="course">
            <div class="col-sm-2 control-label">题目题库</div>
            <div class="col-sm-10">
                <div  v-for="num in nums2">
                    <div class="col-sm-12">
                        <div class="col-sm-7">
                            <input type="text" class="form-control" style="cursor:pointer; margin-left: -18%;"
                                   :v-model="'sysTest.courseName'+num"  :id="'courseName'+num"
                                   @click="courseTree(num)" readonly="readonly" placeholder="一级科目"/>
                        </div>
                        <div class="col-sm-5">
                            <select :v-model="'sysTest.topicId'+num" class="refresh-seconds-select btn" :id="'topicId'+num"
                                    style="width:160px;margin-left: -18%;;border: 1px solid #ccc;" @change="change2(num)">
                                <option v-for="item in items2[num-1]" :value="item.value">{{item.text}}</option>
                            </select>
                        </div>
                    </div>
                    <div class="col-sm-10 control-label"></div>
                    <div class="col-sm-12">
                        <div class="col-sm-7">
                            <input type="text" class="form-control" style="margin-left: -18%;" placeholder="题目个数" :id="'subject'+num"/>
                        </div>
                        <div class="col-sm-5"  v-for="(item,index) in timus" >
                            <div v-if="index == (num-1)">
                                <label type="text" style="width: 160px;margin-left: 50%;margin-top: 10px;font-weight: normal;color: #337ab7;"
                                >共有题目:{{item}}道</label>
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-10 control-label"></div>
                    <div class="col-sm-10 control-label"></div>

                </div>

                <div class="col-sm-8">
                    <a class="btn btn-primary" style=" margin-left: 88%;" @click="addt"><i class="fa fa-plus"></i>&nbsp;增加</a>
                </div>
                <div class="col-sm-2">
                    <a class="btn btn-primary" style=" margin-left: 60%;" @click="detelet"><i class="fa fa-trash-o"></i>&nbsp;删除</a>
                </div>
                <div class="col-sm-10 control-label"></div>
                <div class="col-sm-10 control-label"></div>
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-2 control-label">试卷选项</div>
            <div class="col-sm-10">
                <label v-for="item in testType" class="checkbox-inline">
                    <input type="checkbox" :value="item.value" v-model="sysTest.testTypeList" @change="change">{{item.text}}
                </label>
            </div>
        </div>
        <div class="form-group" id="times">
            <div class="col-sm-2 control-label">间隔时间</div>
            <div class="col-sm-10">
                <input type="text" class="form-control" v-model="sysTest.fixTimes" placeholder="间隔时间"/>
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-2 control-label">评卷人</div>
            <div class="col-sm-10">
                <label v-for="item in admins" class="checkbox-inline">
                    <input type="checkbox" :value="item.userId" v-model="sysTest.adminsList">{{item.name}}
                </label>
            </div>
        </div>
        <div class="form-inline clearfix" style="margin-top:30px;margin-left: 18px;">
            <div class="form-group">
                <div class="col-sm-5 control-label">参考部门</div>
                <div class="col-sm-7">
                    <ul id="dataTree" class="ztree"></ul>
                </div>
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-2 control-label"></div>
            <input type="button" class="btn btn-primary" id="btnSaveOrUpdate" data-loading-text="保存中..."
                   @click="saveOrUpdate" value="确定"/>
            &nbsp;&nbsp;<input type="button" class="btn btn-warning" @click="reload" value="返回"/>
        </div>

        <div v-for="num in nums2">
            <div :id="'courseLayer'+num" style="display: none;padding:10px;">
                <ul :id="'courseTree'+num" class="ztree"></ul>
            </div>
        </div>
    </form>
</div>


<div v-show="!showList2" class="panel panel-default">
    <div class="panel-heading">{{title}}</div>
    <div id="news">
        <div class="test_paper_top">
            <div class="padding15">
            </div>
        </div>
    </div>
    <div class="form-group">
        <div class="col-sm-2 control-label"></div>
        <input type="button" class="btn btn-warning" @click="reload" value="返回"
               id="fh"/>
    </div>
</div>

</div>

<!-- 选择部门 -->
<div id="deptLayer" style="display: none;padding:10px;">
    <ul id="deptTree" class="ztree"></ul>
</div>
<script src="${request.contextPath}/statics/js/common.js?_${.now?long}"></script>
<script src="${request.contextPath}/statics/js/modules/test/systest.js?_${.now?long}"></script>
</body>
</html>